package org.dizem.freepl0.compiler;


import org.dizem.freepl0.compiler.targetcodemanager.TargetCodeManager;
import org.dizem.freepl0.compiler.errormanager.ErrorManager;
import org.dizem.freepl0.compiler.reader.Reader;
import org.dizem.freepl0.compiler.tablemanager.TableManager;

/**
 * Created by IntelliJ IDEA.
 * User: DIZEM
 * Date: 11-2-1
 * Time: 下午11:43
 */
public class FPCompiler {
	
	private Reader reader;
	private WordAnalysis wordAnalysis;
	private ErrorManager errorManager;
	private GrammaAnalysis grammaAnalysis;
	private TableManager tableManager;

	private TargetCodeManager targetCodeManager;

	public FPCompiler(String code) {
		reader = new Reader(code);
		errorManager = new ErrorManager(this);
		wordAnalysis = new WordAnalysis(this);

		targetCodeManager = new TargetCodeManager(this);
		tableManager = new TableManager(this);
		grammaAnalysis = new GrammaAnalysis(this);
	}


	public void compile() {
		grammaAnalysis.analysis();
	}

	public Reader getReader() {
		return reader;
	}

	public GrammaAnalysis getGrammaAnalysis() {
		return grammaAnalysis;
	}

	public TableManager getTableManager() {
		return tableManager;
	}

	public WordAnalysis getWordAnalysis() {
		return wordAnalysis;
	}

	public ErrorManager getErrorManager() {
		return errorManager;
	}

	public TargetCodeManager getTargetCodeManager() {
		return targetCodeManager;
	}
}
